#ifndef _KEY_H_
#define _KEY_H_
#include "main.h"
#define PCB_VERSION 3 
#if (PCB_VERSION == 1)
#define KEY1_PORT CW_GPIOB
#define KEY1_PIN GPIO_PIN_3
#define KEY2_PORT CW_GPIOA
#define KEY2_PIN GPIO_PIN_15
#define KEY3_PORT CW_GPIOB
#define KEY3_PIN GPIO_PIN_5
#define KEY4_PORT CW_GPIOC
#define KEY4_PIN GPIO_PIN_13
#define KEY5_PORT CW_GPIOB
#define KEY5_PIN GPIO_PIN_7
#elif (PCB_VERSION == 2)
#define KEY1_PORT CW_GPIOB
#define KEY1_PIN GPIO_PIN_3
#define KEY2_PORT CW_GPIOA
#define KEY2_PIN GPIO_PIN_15
#define KEY3_PORT CW_GPIOB
#define KEY3_PIN GPIO_PIN_5
#define KEY4_PORT CW_GPIOC
#define KEY4_PIN GPIO_PIN_13
#define KEY5_PORT CW_GPIOB
#define KEY5_PIN GPIO_PIN_7
#else
#define KEY1_PORT CW_GPIOC
#define KEY1_PIN GPIO_PIN_13
#define KEY2_PORT CW_GPIOB
#define KEY2_PIN GPIO_PIN_7
#define KEY3_PORT CW_GPIOB
#define KEY3_PIN GPIO_PIN_5
#define KEY4_PORT CW_GPIOB
#define KEY4_PIN GPIO_PIN_3
#define KEY5_PORT CW_GPIOA
#define KEY5_PIN GPIO_PIN_15
#endif
enum KeyStaEnum
{
    KEY_NONE,
    KEY_OK,
    KEY_DOW,
    KEY_RIGHT,
    KEY_LEFT,
    KEY_UP,

    KEY_UP_LONG = 9,
    KEY_DOW_LONG,
    KEY_LEFT_LONG,
    KEY_RIGHT_LONG,
    KEY_OK_LONG,
};
void key_init(void);
void key_scan(void);
uint8_t key_get_event(void);
#endif
